<template>

    <div class="brand-wrapper">
        <!--      查询表单 -->
        <div class="search-form">
            <el-form :inline="true" class="demo-form-inline" size="mini">
                <el-form-item label="商品名称">
                    <el-input placeholder="请输入商品名称" v-model="searchParams.goodsName"></el-input>
                </el-form-item>

                <el-form-item label="商品状态">
                    <!--动态渲染  选择品牌-->
                    <el-select placeholder="选择商品状态" v-model="searchParams.approveStatus">
                        <el-option
                                :value="0">待审核
                        </el-option>
                        <el-option
                                :value="1">已审核
                        </el-option>
                        <el-option
                                :value="2">审核不通过
                        </el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="开始时间">
                    <el-date-picker
                            style="width: 240px"
                            type="datetimerange"
                            :picker-options="dateOptions.pickerOptions"
                            v-model="dateOptions.startDate"
                            value-format="yyyy-MM-dd HH:mm:ss"
                            range-separator="-"
                            @change="chooseTime"
                            start-placeholder="开始日期"
                            end-placeholder="结束日期"
                            align="left">
                    </el-date-picker>
                </el-form-item>

                <el-form-item label="选择类型">
                    <!--动态渲染  选择品牌-->
                    <el-select placeholder="选择类型" v-model="searchParams.productId">
                        <el-option v-for="(item,index) in modelList" :key="index" :label="item.productModel"
                                   :value="item.id"></el-option>
                    </el-select>
                </el-form-item>

                <!--        <el-form-item label="活动区域">-->
                <el-form-item>
                    <el-button type="primary" @click="searchPage1">查询</el-button>
                    <el-button type="warning" @click="resetForm">重置</el-button>
                </el-form-item>
            </el-form>
        </div>

        <!--    表格数据-->
        <!--:tree-props="{children: 'children'
            row-key="id"
         树状结构 children-->
        <div class="data-box">
            <el-table
                    :data="tableData"
                    style="width: 100%"
                    @selection-change="selectChange">
                <el-table-column
                        align="center"
                        type="selection"
                        width="55">
                </el-table-column>

                <el-table-column type="expand">
                    <template slot-scope="props">
                        <el-form label-position="left" inline class="demo-table-expand">
                            <el-form-item label="商品id">
                                <span>{{ props.row.goodsId }}</span>
                            </el-form-item>
                            <el-form-item label="商品名称">
                                <span>{{ props.row.goodsName }}</span>
                            </el-form-item>
                            <el-form-item label="需要调整价格的商品数量">
                                <span>{{ props.row.adjustGoodsNumber }}</span>
                            </el-form-item>
                            <el-form-item label="市场价">
                                <span>{{ props.row.marketPrice }}</span>
                            </el-form-item>
                            <el-form-item label="商城价">
                                <span>{{ props.row.mallPrice }}</span>
                            </el-form-item>
                            <el-form-item label="活动促销价">
                                <span>{{ props.row.adjustPrice }}</span>
                            </el-form-item>
                            <el-form-item label="活动开始时间">
                                <span>{{ props.row.startTime }}</span>
                            </el-form-item>
                            <el-form-item label="活动结束时间">
                                <span>{{ props.row.endTime }}</span>
                            </el-form-item>
                            <el-form-item label="生效时间">
                                <span>{{ props.row.effectTime }}</span>
                            </el-form-item>
                            <el-form-item label="失效时间">
                                <span>{{ props.row.expireTime }}</span>
                            </el-form-item>
                            <el-form-item label="活动原因">
                                <span>{{ props.row.reason }}</span>
                            </el-form-item>
                            <el-form-item label="活动策划文件">
                                <span>{{ props.row.file }}</span>
                            </el-form-item>
                            <el-form-item label="备注">
                                <span>{{ props.row.detail }}</span>
                            </el-form-item>
                        </el-form>
                    </template>
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="id"
                        label="序号">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="activityName"
                        label="活动名称">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="startTime"
                        label="活动开始时间">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="adjustPrice"
                        label="活动促销价">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="effectTime"
                        label="希望价格生效时间">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="approveStatus"
                        label="审批状态">
                </el-table-column>
                <el-table-column

                        label="操作"
                        width="350">
                    <template v-slot="hanjie">
                        <el-button type="primary" size="mini" icon="el-icon-edit"
                                   @click="dialogVisible=true,formData.id=hanjie.row.id,findById()"></el-button>
                        <el-button type="primary" size="mini"
                                   @click="dialogVisible3=true,formData=hanjie.row">审核
                        </el-button>
                        <el-popconfirm
                                confirm-button-text='确定'
                                cancel-button-text='取消'
                                icon="el-icon-info"
                                icon-color="red"
                                @confirm="deleteById"
                                placement="top"
                                title="是否要删除本条记录？"
                        >
                            <el-button slot="reference" type="danger" size="mini" @click="formData.id=hanjie.row.id"
                                       icon="el-icon-delete"></el-button>
                        </el-popconfirm>
                    </template>
                </el-table-column>
            </el-table>

        </div>


        <!--    分页-->
        <div class="page-box">
            <el-pagination
                    background
                    layout="prev, pager, next"
                    :total="total"
                    :page-size="searchParams.pageSize"
                    :current-page="searchParams.currentPage"
                    @current-change="currentPageChange"
            >
            </el-pagination>

        </div>
        <!--新增审核跟踪的弹窗-->
        <!--弹框-->
        <el-dialog
                title="实体操作"
                :visible.sync="dialogVisible3"
                width="70%"
        >
            <el-form ref="form" label-width="80px" :model="formData" size="small">
                <el-tabs v-model="activeName">
                    <!--element ui 的 Tabs 标签页 -->
                    <el-form-item label="序号">
                        <el-input v-model="formData.id" ></el-input>
                    </el-form-item>
                    <el-form-item label="审批人">
                        <el-input v-model="formData.approveName"></el-input>
                    </el-form-item>

                    <el-form-item label="审批时间">
                        <el-date-picker
                                v-model="formData.approveTime"
                                type="date"
                                placeholder="审批时间">
                        </el-date-picker>
                    </el-form-item>
                    <el-form-item label="审批意见">
                        <el-input v-model="formData.approveComment"></el-input>
                    </el-form-item>

                </el-tabs>
            </el-form>
            <span slot="footer" class="dialog-footer">
        <el-button size="mini" @click="dialogVisible3 = false">取消</el-button>
        <el-button type="primary" size="mini" @click="dialogVisible3 = false,updateEntity3(),addGiftsEntity3()">审核通过</el-button>
        <el-button type="primary" size="mini" @click="dialogVisible3 = false,updateEntity4(),addGiftsEntity4()">审核不通过</el-button>
  </span>

        </el-dialog>
    </div>

</template>

<script>
    import activitysInfo from "./index";

    export default activitysInfo;
</script>

<!--src 引用css样式-->
<style src="./index.scss" lang="scss"></style>